package com.wswy.wzcx.utils;

import android.support.annotation.NonNull;

import com.che.libcommon.utils.JsonKit;
import com.google.gson.reflect.TypeToken;

import com.wswy.wzcx.utils.Preference.Converter;
import java.util.List;

/**
 * Created by wangduheng26 on 2017/12/7.
 * wangduheng26@gmail.com
 */

public class SimpleListConvertAdapter<T> implements Converter<T> {

    @NonNull
    @Override
    public T deserialize(@NonNull String serialized) {

        return JsonKit.GSON.fromJson(serialized, new TypeToken<List<String>>() {
        }.getType());
    }

    @NonNull
    @Override
    public String serialize(@NonNull T value) {
        return JsonKit.GSON.toJson(value);
    }

}
